package com.jx.lcs.thread;

import java.util.concurrent.RejectedExecutionException;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.task.TaskExecutor;

/**
 * 线程池
 */
public class ExecutorTask {

	private static final Logger logger = LoggerFactory.getLogger(ExecutorTask.class);

	private TaskExecutor taskExecutor;

	public void doExecute(Runnable runnable) {
		try {
			taskExecutor.execute(runnable);
		} catch (RejectedExecutionException e) {
			e.printStackTrace();
			logger.error("线程池调度异常", e);
		}
	}

	public TaskExecutor getTaskExecutor() {
		return taskExecutor;
	}

	public void setTaskExecutor(TaskExecutor taskExecutor) {
		this.taskExecutor = taskExecutor;
	}

}